package com.py.payment.controller;

import com.py.payment.entity.PySystemConfig;
import com.py.payment.service.PySystemConfigService;
import com.py.payment.tools.ToolsUtils;
import com.py.payment.tools.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/config")
@CrossOrigin(origins = "*")
public class SystemConfigController {

    @Autowired
    private PySystemConfigService systemConfigService;

    @PostMapping(name = "保存/编辑支付情况",path = "/saveSystemConfig")
    public ResponseData saveSystemConfig(@RequestBody PySystemConfig systemConfig) {
        if(ToolsUtils.isNotEmpty(systemConfig.getId())){
            this.systemConfigService.updateById(systemConfig);
        } else {
            this.systemConfigService.save(systemConfig);
        }
        return ResponseData.success();
    }
}
